package chapter01;

/**
 * Created by 1 on 2017/8/14.
 * 向上向下转型
 */
public class UpCastTest {

    static class A {
        public void a() {
            System.out.println("this is a method!");
        }
    }

    static class B extends A{

        public void a() {
            System.out.println("傻逼!");
        }

        public void b() {
            System.out.println("this is b method!");
        }

        public void b1() {
            System.out.println("this is b method!");
        }

    }

    public static void main(String[] args) {
        A a = new B();
        a.a();

        B b = (B) a;
        b.a();
        b.b();
        b.b1();
    }
}
